package com.hansintelligent.rrrmvpframework.view.login.ui;

import android.widget.Button;
import android.widget.Toast;

import com.blankj.utilcode.util.ToastUtils;
import com.hansintelligent.rrrmvpframework.R;
import com.hansintelligent.rrrmvpframework.base.BaseActivity;
import com.hansintelligent.rrrmvpframework.bean.UserInfo;
import com.hansintelligent.rrrmvpframework.view.login.contract.LoginContract;
import com.hansintelligent.rrrmvpframework.view.login.presenter.LoginPresenter;

import butterknife.BindView;
import butterknife.OnClick;


/**
 * 登录界面
 */
public class LoginActivity extends BaseActivity implements LoginContract.IViewContract {
    @BindView(R.id.login)
    Button login;
    private LoginPresenter mPresenter;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_login;
    }

    @Override
    protected void initView() {
        mPresenter = new LoginPresenter();
        mPresenter.attachView(this);//关联P与V
    }

    @Override
    protected void initData() {

    }


    @OnClick(R.id.login)
    public void onViewClicked() {

        mPresenter.login();
    }


    @Override
    public void loginSuccess(UserInfo content) {
        ToastUtils.showShort(content.getNickname());
    }
}
